const loginReducer = (state = {
	isLogined: false,
	isToggle: false
}, action) => {
	switch (action.type) {
		case "LOGIN_ERROR":
			return Object.assign({}, state, {
				isLogined: false,
				loginError: action.loginError
			})
		case "LOGIN_SUCCESS":
			return Object.assign({}, state, {
				isLogined: true,
				loginError: {},
				userInfo: action.userInfo
			})
		case "LOGOUT_SUCCESS":
			return Object.assign({}, state, {
				isLogined: false,
				loginError: {},
				userInfo: {
					msg: "Place Login"
				}
			})
		case "LOGIN_WINDOW_TOGGLE":
			return Object.assign({}, state, {
				isToggle: !state.isToggle
			})
		default:
			return state
	}
}

export default loginReducer